import { createBrowserRouter ,Navigate } from "react-router-dom";
// import { lazy } from "react";
import Login from "@/pages/login";
import Article from "@/pages/article";
import Categories from "@/pages/categories";
import Basics from "@/pages/basics"; 
import Profile from "@/pages/personal/profile";
import Resetpwd from "@/pages/personal/resetpwd";
import Layout from "@/pages/layout";

// const Login = lazy(() => import("@/pages/login"));
// const Layout = lazy(() => import("@/pages/layout"));
// const Categories = lazy(() => import("@/pages/categories"));
// const Article = lazy(() => import("@/pages/article"));
// const Basics = lazy(() => import("@/pages/basics/index"));
// const Profile = lazy(() => import("@/pages/personal/profile"));
// const Resetpwd = lazy(() => import("@/pages/personal/resetpwd"));
const routes = createBrowserRouter([
    // 重定向
   
    {
        path: "/login",
        element: <Login/>,
    },
    {
        path: "/",
        element: <Layout/>,
        children:[
            // 重定向
            {
                path:'/',
                element: <Navigate to="/categories" replace/>
            },
            {
                path:'categories',
                element: <Categories/>
            },
            {
                path:'article',
                element: <Article/>
            },
            {
                path:'basics',
                element: <Basics/>
            },
            {
                path:'personal/profile',
                element: <Profile/>
            },
            {
                path:'personal/resetpwd',
                element: <Resetpwd/>
            },
        ]
    }
])


export default routes